package com.livestocksolutions;

import java.util.ArrayList;
import java.util.Date;

/* -- Version History --
 *  1.0 : 22 July 2012 - Initial version.
 *  
 *  1.1 : 22 July 2012 - Changed soldCows to soldCattle to reflect generalisation of the cattle to be sold.
 *                       Changed ArrayList<Bovine> getSoldCows() to ArrayList<Bovine> getSoldCattle() to reflect
 *                       generalisation of the cattle to be sold.
 */

/**
 * This class stores a monetary transaction that have occurred in relation to the selling of Bovines
 * @author Adam Parr
 * @version 1.1
 * 
 * @.modified 22 July 2012
 */
public class Sale extends Transaction {
	/**
	 * Cattle that were sold in this sale
	 */
	private ArrayList<Bovine> soldCattle = new ArrayList<Bovine>();
	
	/**
	 * Creates a new Sale
	 * @param transactionID A unique number to identify this Sale
	 * @param amount the amount this sale made
	 * @param date the date of this sale
	 */
	public Sale(int transactionID, double amount, Date date){
		super(transactionID, amount, date);
	}
	
	/**
	 * Creates a new Sale of the given Cattle
	 * @param transactionID A unique number to identify this Sale
	 * @param amount the amount this sale made
	 * @param date the date of this sale
	 * @param soldCattle The cattle that were sold in this sale
	 */
	public Sale(int transactionID, double amount, Date date, ArrayList<Bovine> soldCattle){
		super(transactionID, amount, date);
		this.soldCattle=soldCattle;
	}
	
	/**
	 * Get the list of sold cattle
	 * @return An Array of Cattle sold or <code>null</code> if no Cattle were sold in this sale.
	 * @.TODO should we return the reference to the Array (which could result in this class being bypassed)
	 * or change return type to Bovine[] by using soldCattle.toArray(new Bovine[]{}); While this
	 * will take extra time to create this new Object, the reference to the ArrayList Object will not be given
	 * to the calling Object.
	 */
	public ArrayList<Bovine> getSoldCattle(){
		return soldCattle;
	}
}
